package com.incross.itracker.tracking;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

import com.incross.itracker.util.BKLog;


public class ApplicationInformation {
	
	private Context mContext;
	private String mAppVersion = "";
	private String mPackageName = "";
	
	
	public ApplicationInformation(Context context) {
		mContext = context;
		getApplicationInfo();
	}
	
	private void getApplicationInfo() {
		mPackageName = mContext.getPackageName();
		PackageInfo pInfo;
		try {
			pInfo = mContext.getPackageManager().getPackageInfo(mPackageName, 0);
			mAppVersion = pInfo.versionName;
		} catch(NameNotFoundException e) {
			e.printStackTrace();
		}
		
		BKLog.i("App version : " + mAppVersion + ", Package name : " + mPackageName);
		
	}
	
	public String getAppVersion() {
		return ((mAppVersion == null || mAppVersion.equals(""))? "UNKNOWN": mAppVersion);
	}
	
	public String getPackageName() {
		return ((mPackageName == null || mPackageName.equals(""))? "UNKNOWN": mPackageName);
	}
	
	
	
	
	

}

